#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :page_register.py
# @Time      :2021/8/2 15:44
# @author    :Harry
from selenium.webdriver.common.by import By


class PageRegister():
    def __init__(self, driver):
        self.driver = driver

    def ele_register_username(self):
        self.driver.find_element(By.NAME, 'username').send_keys('zsan4')

    def ele_register_email(self):
        self.driver.find_element(By.NAME, 'email').send_keys('zsan4@126.com')

    def ele_register_password(self):
        self.driver.find_element(By.NAME, 'password').send_keys('zs123456')

    def ele_register_confirm_password(self):
        self.driver.find_element(By.NAME, 'confirm_password').send_keys('zs123456')

    def ele_register_mobile(self):
        self.driver.find_element(By.NAME, 'extend_field5').send_keys('13112345678')

    def ele_register_submit(self):
        self.driver.find_element(By.NAME, 'Submit').click()

    def assert_register(self):
        actual_result = self.driver.find_element(By.XPATH, '//font[@id="ECS_MEMBERZONE"]/a[1]').text
        return actual_result

    def register(self):
        self.ele_register_username()
        self.ele_register_email()
        self.ele_register_password()
        self.ele_register_confirm_password()
        self.ele_register_mobile()
        self.ele_register_submit()
        assert_result = self.assert_register()
        return assert_result
